import request from '@/utils/request'

export function fetchList(query) {
    return request({
        url: '/user/api/user/query/page',
        method: 'get',
        params: query
    })
}
//获取故障配置信息
export function fetchFaultInfo(query) {
    return request({
        url: '/user/api/dictionary/query/fault',
        method: 'get',
        params: query
    })
}
//保存/修改设备分类信息
export function saveCategoryInfo(query) {
    if (query.id) {
        return request({
            url: '/device/api/assetType',
            method: 'put',
            data: query
        })
    } else {
        return request({
            url: '/device/api/assetType',
            method: 'post',
            data: query
        })
    }

}

//设备排序
export function sortDepartmentInfo(query) {
    return request({
        url: '/device/api/assetType/order',
        method: 'put',
        data: query
    })
}


//保存故障信息
export function saveTroubleInfo(query) {
    return request({
        url: '/user/api/dictionary/fault',
        method: 'put',
        data: query
    })
}
//查询维修上限
export function fetchRepairedInfo(query) {
    return request({
        url: '/user/api/dictionary/query/repairLimit',
        method: 'get',
        data: query
    })
}
//保存维修上限
export function saveRepairedInfo(query) {
    return request({
        url: '/user/api/dictionary/repairLimit',
        method: 'put',
        data: query
    })
}
//设备详细信息
export function fetchDetailInfo(query) {
    return request({
        url: '/device/api/assetType/query/' + query,
        method: 'get',
    })
}

//删除台账
export function deleteDeviceInfo(query) {
    return request({
        url: '/device/api/assetType/' + query,
        method: 'delete',
        //data: query
    })
}
//启用
export function startUserInfo(query) {
    return request({
        url: '/user/api/user/start/' + query,
        method: 'put',
        //data: query
    })
}
//停用
export function stopUserInfo(query) {
    return request({
        url: '/user/api/user/stop/' + query,
        method: 'put',
        //data: query
    })
}